<%@ page import="com.hdu.heihei.beans.User" %>
<%@ page import="com.hdu.heihei.beans.User" %>
<%--
  Created by IntelliJ IDEA.
  User: fengyuan
  Date: 2020/9/29
  Time: 00:35
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>编辑界面</title>
</head>
<body>
<%
    User user = new User();
    Cookie[] cookies = request.getCookies();
    for (Cookie cookie : cookies){
        if(cookie.getName().equals("userId")){
            user.setId(Integer.parseInt(cookie.getValue()));
        }else if (cookie.getName().equals("username")){
            user.setUsername(cookie.getValue());
        }else if (cookie.getName().equals("password")){
            user.setPassword(cookie.getValue());
        }
    }
%>
<div>
    <input type="submit" value="注销账号" name="cancellation" onclick="javascript:window.location.href='../controller/cancellation.jsp'">
    <input type="submit" value="退出登录" name="exit" onclick="javascript:window.location.href='../login.html'">
    <div>
        <div>username:<%=user.getUsername()%></div>
        <div>password:<%=user.getPassword()%></div>
    </div>
    <br>
    <br>
    <div>
        <form action="../controller/update.jsp">
            <div>若要更新的话</div>
            <div>
                账号：<input type="text" name="username">
            </div>
            <div>
                密码：<input type="password" name="password">
            </div>
            <div>
                <input type="hidden" name="id" value=<%=user.getId()%>>
            </div>
            <input type="submit" value="更新" name="update">
        </form>
    </div>
</div>

</body>
</html>
